package com.futures.investm.adapter;

import android.util.SparseBooleanArray;
import android.view.View;

import com.futures.investm.R;
import com.futures.investm.entity.CoinFlashEntity;
import com.futures.investm.utils.DateUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ms.square.android.expandabletextview.ExpandableTextView;

/**
 * Anthor:HeChuan
 * Time:2019/1/3
 * Desc:
 */
public class CoinFlashAdapter extends BaseQuickAdapter<CoinFlashEntity,BaseViewHolder> {

    SparseBooleanArray sparseBooleanArray = new SparseBooleanArray();
    public CoinFlashAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, CoinFlashEntity item) {
        helper.setText(R.id.tv_time, DateUtil.formatDate(DateUtil.parse(item.getDate()),DateUtil.FORMAT_100))
                .setText(R.id.tv_title,item.getTitle())
                .setOnClickListener(R.id.iv_share, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
//                        ShareUtil.showShare((Activity) mContext);
                    }
                }).setOnClickListener(R.id.iv_report, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                FastUtil.startActivity(mContext, ReportActivty.class);
            }
        });

        ExpandableTextView expandableTextView = helper.getView(R.id.expand_text_view);
        expandableTextView.setText(item.getTxt(),sparseBooleanArray,helper.getPosition());
    }
}
